import Vue from 'vue'
import App from './App'

import UtilsPlugin from '@/plugins/utils'
Vue.use(UtilsPlugin)


import { VueJsonp } from 'vue-jsonp'
Vue.use(VueJsonp)

import store from '@/store'
Vue.prototype.$store = store

import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom)

import MyEmpty from '@/components/MyEmpty'
Vue.component('my-empty',MyEmpty)

import share from'@/plugins/mixin-share.js';
Vue.mixin(share)

/**
 * 获取图片完整地址
 * @author 深圳前海万联科技有限公司 <www.wanlshop.com>
 * 
 * @param {Object} url 提示标题，不需要OSS处理
 */
const appstc = (url) => {
	// console.log(url)
	//https://www.yycjkb.cn
	let cdnurl = '';
	if(process.env.NODE_ENV === 'development'){
		// #ifdef H5
			cdnurl = 'https://www.yycjkb.cn'
		// #endif
	} else {
		// #ifdef H5
			cdnurl = window.location.origin
		// #endif
	}
	
	let image = '';
	//当地址不存在
	if (url) {
		if ((/^data:image\//.test(url))) {
			image = url;
		}else if((/^(http|https):\/\/.+/.test(url))){
			image = url;
		}else{
			image = cdnurl + url;
		}
	}else{
		image = './static/default.png';
	}
	return image;
}

/**
 * Public 全局方法
 * 
 * @method $appstc 服务器图片地址
 * 
 */
Vue.prototype.$public = {
	appstc
};

Vue.config.productionTip = false

App.mpType = 'app'



const app = new Vue({
	store,
    ...App
})
app.$mount()

 



